package cn.tedu.spring.eg3;

import jakarta.annotation.PostConstruct;
import jakarta.annotation.PreDestroy;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
@Component
public class shopController {
    private String shopname;

    public shopController() {
        System.out.println("1.调用无参构造实例化");
    }
    @Value("中秋节")
    public void setShopname(String shopname) {
        this.shopname = shopname;
        System.out.println(shopname);
        System.out.println("2.调用set()方法属性赋值");
    }

    @PostConstruct
    public void init(){
        System.out.println("3.执行生命周期初始化");
    }
    @PreDestroy
    public void destory(){
        System.out.println("5.执行生命周期销毁阶段");
    }
}
